#ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QtOpenGL/qgl.h>
#include <string>
#include <iostream>
using namespace std;

enum DISPLAYTYPE
{
original, 
initial,
ultimate, 
current, 
deflt
};

class GLWidget : public QGLWidget
{
  Q_OBJECT

public:
  GLWidget(QWidget *parent = 0);
  ~GLWidget();

  QSize minimumSizeHint() const;
  QSize sizeHint() const;

	void drawFramework(double xmin, double xmax, 
									   double ymin, double ymax, 
										 double zmin, double zmax, 
										 double scale);
	void setFileName(const char *ch){filename = ch;}
	void setDisplayType(DISPLAYTYPE type){ disType = type; }
	DISPLAYTYPE getDisplayType(){ return disType; }

public slots:
  void setXRotation(int angle);
  void setYRotation(int angle);
  void setZRotation(int angle);
	void classSelected(const QString item);
	void itrtSelected(const QString item);

signals:
  void xRotationChanged(int angle);
  void yRotationChanged(int angle);
  void zRotationChanged(int angle);

protected:
  void initializeGL();
  void paintGL();
  void resizeGL(int width, int height);
  void mousePressEvent(QMouseEvent *event);
  void mouseMoveEvent(QMouseEvent *event);

  virtual GLuint makeObject()
	{
		return 0;
	}

private:
  void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
  void normalizeAngle(int *angle);

  GLuint object;
  int xRot;
  int yRot;
  int zRot;
  QPoint lastPos;
  QColor trolltechGreen;
  QColor trolltechPurple;
	DISPLAYTYPE disType;

protected :
  string filename;
	unsigned int clsToDisplay;
	unsigned int itrtToDisplay;
};
//! [3]

#endif
